package cn.xiaomubiao.oschine.adapter.myinfo;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import cn.xiaomubiao.oschine.R;
import cn.xiaomubiao.oschine.bean.Friend;
import cn.xiaomubiao.oschine.util.UIUtils;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * @author
 * @version 1.0
 * @date 2017/4/8
 */

public class MyInfoFocusAdapter extends  MyInfoBaseListAdapter<Friend> {
    

    @Override
    protected void initItemView(View itemView, int position) {
        CircleImageView avatarView = (CircleImageView) itemView.findViewById(R.id.iv_avatar);
        TextView name = (TextView) itemView.findViewById(R.id.tv_name);
        ImageView sex = (ImageView) itemView.findViewById(R.id.iv_gender);
        TextView from = (TextView) itemView.findViewById(R.id.tv_from);
        TextView des = (TextView) itemView.findViewById(R.id.tv_desc);
        Glide.with(UIUtils.getContext()).load(datas.get(position).getPortrait()).into(avatarView);
        name.setText(datas.get(position).getName());
        if (datas.get(position).getGender() == 1){
            sex.setImageResource(R.drawable.userinfo_icon_male);
        }else {
            sex.setImageResource(R.drawable.userinfo_icon_female);
        }
        
        from.setText(datas.get(position).getFrom());
        des.setText(datas.get(position).getExpertise());
    }

    @Override
    public int getLayoutId() {
        return R.layout.view_item_myinfo_friend;
    }
}
